<!--suppress HtmlUnknownTag -->
<root xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude">
  <xi:include href="rds.html"/>

  <?python
      from mnemoply.utils import format_date
      import os,datetime
      from base64 import b64encode
      from mnemoply.model.agreement import StudentAgreement
      from mnemoply.model.field import Group, StudentInGroup,LessonInSchedule
      from mnemoply.utils import getBarcodeImage, read_binary_file
      from mnemoply.common_knowledge import month_captions
      from mnemoply._renewed_model.field import EducationAgreement
      ?>

  <report>
    <pages py:if="ids">

      <?python
           objs = [EducationAgreement.get(int(x)) for x in ids]
       ?>
      <page py:for="o in objs">
      <?python
                agr = o.report_obj()
                barcodes_dir = "barcodes"
                tmp_payment_type = "00"
                barcode_num = tmp_payment_type + str(agr.agr_id).rjust(5, "0")
                barcode_file = getBarcodeImage(barcode_num, barcodes_dir)
                barcode_b64 = b64encode(read_binary_file("./" + barcode_file))
      ?>  
            <customer py:content="agr.customer" />
            <student py:content="agr.student" />
            <birthday py:content="agr.birthday" />
            <school_name py:content="agr.school_name" />
            <school_form py:content="agr.school_form" />
            <phone py:content="agr.phone"/>
            <agr_id py:content="agr.agr_id"/>
            <group py:content="agr.group" />
            <end_date py:content="agr.end_date" />
            <start_date  py:content="agr.start_date" />
            <duration  py:content="agr.duration"/>
            <plan  py:content="agr.plan"/>
            <tariff  py:content="agr.tariff"/>
            <comment py:content="agr.comment"/>
            <duration py:content="agr.lessonPeriod"/>
            <trend py:content="agr.trend"/>
       </page>
    </pages>
  </report>

</root>
